<template>
	<view class="container"  v-if="orderInfo">
		<view class="stepContain">
			<view class="leftInfo">
				<view>
					订单编号：{{orderInfo.orderNo}}
				</view>
				<view>下单时间：{{orderInfo.createTime}}</view>
			</view>
			<view class="sattus">
				{{orderInfo.status}}
			</view>
		</view>
		<view class="concat">
			<!-- <view class="iconContext">
				<uniIcon type="location-filled" color="#cccccc"></uniIcon>
			</view> -->
			<view class="concatinfo">
				<view class="concatTitle">
					收货人信息
				</view>
				<view class="concater">
					{{orderInfo.userName}}
					<text class="phone">{{orderInfo.userPhone}}</text>
				</view>
				<view class="address">
					{{orderInfo.userAddress}}
				</view> 
			</view>
		</view>

    <view class="self-mentioning-info" v-if="orderInfo.deliverType === 1 && orderInfo.status !== '待支付' ">
      <view class="concatinfo">
        <view class="concatTitle">
          自提信息
        </view>
        <view class="concater">
          门店:
          <text class="value-la">{{ orderInfo.store.storeName }}</text>
        </view>
        <view class="concater">
          电话
          <text class="value-la">{{ orderInfo.store.storeTel }}</text>
        </view>
        <view class="concater">
          地址
          <text class="value-la">{{ orderInfo.store.storeAddress }}</text>
        </view>
        <view class="concater">
          核验码
          <text class="value-la " style="color: red; font-size: 38rpx;"> {{orderInfo.verificationCode.replace(/(.{4})/g, "$1 ")}}</text>
        </view>
        <view class="qrcode">
          <image :src="orderInfo.qrCode"></image>
        </view>
      </view>
    </view>
		<view class="goods">
			<view class="storeInfo">
				<view class="store">
					<uniIcon type="shop"></uniIcon>
					{{orderInfo.shopName}}
				</view>
				<!-- <view class="">
					{{orderInfo.}}
				</view> -->
			</view>
			<block v-if="orderInfo.goods.length">

				<view class="goodsItem" v-for="(goodsItem,index) in orderInfo.goods" :key="index" @click="todetail(goodsItem.goodsId)">
					<image :src="goodsItem.goodsImg" class="goodPic" mode="aspectFill"></image>
					<view class="context">
						<view class="goodsName">
							{{goodsItem.goodsName}}
						</view>
						<view class="spec">
							<view class="price">
								￥{{goodsItem.goodsPrice}}
							</view>
							<view class="num">
								x{{goodsItem.goodsNum}}
							</view>
						</view>
					</view>
				</view>

			</block>

			<view class="orderstatic">
				<view class="orderType">
					{{orderInfo.orderCodeTitle}}
				</view>
				<view class="totalBox">
					订单总价
					<text class="price">￥{{orderInfo.realTotalMoney}}</text>
				</view>
			</view>
		</view>
		<view class="ordermixed">
			<view>支付信息：{{orderInfo.payInfo}}</view>
			<view>配送信息：{{orderInfo.deliverInfo}}</view>
			<view>发票信息：{{orderInfo.isInvoice==1?'需要':'不需要'}}</view>
			<view v-if="orderInfo.isInvoice==1">发票状态：{{orderInfo.isMakeInvoice==1?'已开':'未开'}}</view>
			<view class="remark">
				<view>
					订单备注：
				</view>
				<view class="remarkText">
					{{orderInfo.orderRemarks}}
				</view>
			</view>
		</view>
		<view class="spendBox">
			<view class="betwContainer">
				<view>
					<text>获得积分</text>
					<text>{{orderInfo.orderScore}}个</text>
				</view>
				<view>
					<text>商品总额</text>
					<text>￥{{orderInfo.goodsMoney}}</text>
				</view>
				<view>
					<text>运费</text>
					<text>￥{{orderInfo.deliverMoney}}</text>
				</view>
				<view>
					<text>积分抵扣</text>
					<text>-{{orderInfo.scoreMoney}}</text>
				</view>
			</view>
			<view class="payBox">
				实付款
				<text>￥{{orderInfo.realTotalMoney}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcon from '@/components/uni-icons/uni-icons.vue'
	export default {
		components: {
			uniIcon
		},
		data() {
			return {
				orderId: 0,
				orderInfo: null
			};
		},
		onLoad(options) {
			let id = options.id
			this.orderId = id
			this.loadDetail()
		},
		methods: {
			todetail(id) {
				uni.navigateTo({
					url: '/pages/product/product?id=' + id
				})
			},
			loadDetail() {
				let that = this
				that.$Request.request('/api/orders/getDetail', 'POST', {
					id: that.orderId
				}).then(res => {
					if (res.status == 1) {

						that.orderInfo = res.data
					}

				}).catch(err => {
					console.log(err)
				})
			}
		},

	}
</script>

<style lang="scss">
	@import './detail.scss'
</style>
